home *** CD-ROM | disk | FTP | other *** search
- *****Listing 3*****
-
- #include <stdio.h>
- #include <stdlib.h>
-
- #define SET 1
- #define CLEAR 0
-
- void eh(void);
-
- struct status_flags {
- unsigned f0 : 1;
- unsigned f1 : 1;
- unsigned f2 : 1;
- unsigned f3 : 1;
- } flags = {
- CLEAR, CLEAR, CLEAR, CLEAR
- };
-
- main()
- {
- atexit(eh);
- flags.f2 = 1;
- flags.f3 = 1;
- }
-
- void eh(void)
- {
- if (flags.f0 == SET)
- printf("f0 needs cleanup\n");
- if (flags.f1 == SET)
- printf("f1 needs cleanup\n");
- if (flags.f2 == SET)
- printf("f2 needs cleanup\n");
- if (flags.f3 == SET)
- printf("f3 needs cleanup\n");
- }
-
- f2 needs cleanup
- f3 needs cleanup
-
-